package test.cluster;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import test.domain.environment.MetaThread;

public class MessagePacket implements Externalizable {
	private String testClass;
	private MetaThread metaThread;
	private Type message;
	
	public enum Type {
		start, getresult, quit;
	}

	public void writeExternal(ObjectOutput out) throws IOException {
		out.writeObject(this.testClass);
		metaThread.writeExternal(out);
		out.writeObject(message);
	}

	public void readExternal(ObjectInput in) throws IOException,
			ClassNotFoundException {
		this.testClass = (String) in.readObject();
		
		metaThread = new MetaThread();
		metaThread.readExternal(in);
		
		this.message = (Type) in.readObject();
	}
		
	public String getTestClass() {
		return testClass;
	}
	public void setTestClass(String testClass) {
		this.testClass = testClass;
	}
	public Type getMessage() {
		return message;
	}
	public void setMessage(Type message) {
		this.message = message;
	}
	public MetaThread getMetaThread() {
		return metaThread;
	}
	public void setMetaThread(MetaThread metaThread) {
		this.metaThread = metaThread;
	}
}
